Skip to content

Run defaults for journeys: viewport, user agent and headers - #39

Merged
Mpdreamz merged 2 commits into
mainfrom
feature/journey-run-defaults
Nov 10, 2026
Merged

Mpdreamz merged 2 commits into
mainfrom
feature/journey-run-defaults

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

Why

A harness running journeys against a live site needs three things to be true for every journey in the run, without each file repeating them:

  • the traffic identifies itself as a monitor: docs-builder's frontend turns its telemetry SDK off on the user agent Elastic/Synthetics, and a header marks it too, so test traffic doesn't land in real telemetry;
  • a desktop viewport. At Chrome's default the docs site is in its mobile layout, and find role link click --name "Quick reference" --exact completed with no error while the click did nothing (no request, no URL change). With set viewport 1280 800 the same step works.

The hosts a run may reach are already a run-level option (AllowedHosts, --allow), so nothing is added for them.

What

  • JourneyOptions.Viewport, UserAgent, Headers (npm viewport, userAgent, headers; CLI --viewport 1280x800, --user-agent, --header "Name: value"), applied before the first step.
  • A journey builds on the run rather than undoing it: set headers adds to the run's headers and wins for a name it repeats (Chrome's call replaces the whole set, which would drop the monitor header); set device keeps the run's user agent instead of swapping in the device's; set viewport and set useragent replace theirs.
  • The CLI reports a malformed --header or --viewport as a usage error.
  • Docs: "Run defaults" in the journeys page, the CLI table and the Playwright options table; DECISIONS.

Builds on #34 (set useragent, merged).

Verification

Live tests in both runners against a local server that shows what the page saw and what the server received: defaults applied, no defaults changes nothing, journey headers merge and win, journey user agent and viewport replace, a device keeps the run's user agent. 433 .NET and 325 TS tests pass. Stopped applying the run's headers once in each runner: 2 tests failed in each.

No release or publish.

🤖 Generated with Claude Code

Mpdreamz and others added 2 commits November 10, 2026 12:00
JourneyOptions.Viewport, UserAgent and Headers (viewport, userAgent, headers in @nullean/journeys; --viewport,
--user-agent and --header on cdp run) are in place before the first step, so a harness running against a live site
does not repeat them in every journey. A journey's set headers adds to the run's, set device keeps the run's user
agent, and set viewport and set useragent replace theirs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…dows

Disposing the test server while its serve loop starts another read makes Windows throw
ArgumentException ("The handle is invalid") from BeginGetContext. The loop already returns
on the other disposal errors; this adds that one. It failed the Windows build of two PRs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Mpdreamz
Mpdreamz force-pushed the feature/journey-run-defaults branch from afe660b to 98485e1 Compare November 10, 2026 11:01
@Mpdreamz
Mpdreamz merged commit 1d8c79e into main Nov 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant